package com.gxa.modules.service.impl;


import com.gxa.common.vo.JsonResult;
import com.gxa.common.vo.PageRecv;
import com.gxa.common.vo.ResultVo;
import com.gxa.modules.mapper.Loanafter_EndMapper;
import com.gxa.modules.pojo.LoanSearch;
import com.gxa.modules.pojo.Loanafter_End;
import com.gxa.modules.service.Loanafter_EndService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * Created with IntelliJ IDEA.
 * User: 张剑宇
 * Date: 2021/12/27 10:00
 * Description:
 * Version: V1.0
 */
@Service
public class Loanafter_EndServiceImpl implements Loanafter_EndService {
    @Autowired(required=false)
    private Loanafter_EndMapper loanafter_EndMapper;


    @Override
    public JsonResult queryEnd(PageRecv<LoanSearch> pageRecv) {
        //对查询页面参数计算
        Integer currentPage=pageRecv.getCurrentPage();
        Integer pageSize=pageRecv.getPageSize();
        Integer limit1=(currentPage-1)*pageSize;
        pageRecv.setCurrentPage(limit1);

        //调用Mapper方法获取返回结果
        List<Loanafter_End> list=loanafter_EndMapper.queryEnd(pageRecv);
//        Integer count=loanafter_PayBackMapper.queryPayBackCount(pageRecv.getData());

        //将结果塞入R
        JsonResult r=new JsonResult();
        r.setData(list);
        r.setCode(200);
        r.setMsg("查询成功！");
        r.setCount(2);


        return r;
    }



    @Override
    public ResultVo updateEnd(Loanafter_End loanafter_end) {
        loanafter_EndMapper.updateEnd(loanafter_end);
        ResultVo r=new ResultVo();
        r.setCode(200);
        r.setMsg("修改成功");
        return r;
    }

    @Override
    public ResultVo addEnd(Loanafter_End loanafter_end) {
        loanafter_EndMapper.addEnd(loanafter_end);
        ResultVo r=new ResultVo();
        r.setCode(200);
        r.setData(loanafter_end.getEnd_id());
        r.setMsg("添加成功");
        return r;
    }

}
